抱歉,您的浏览器无法访问本站
本页面需要浏览器支持(启用)JavaScript
了解详情 >

frpc

frpc 拷贝到 /usr/local/bin

配置拷贝到 etc里

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
cp frpc.ini /etc/frp/frpc.ini

[common]
server_addr =
server_port =
token =
user = anarckk
login_fail_exit = false
tls_enable = true

#[ssh]
#type = tcp
#local_ip = 127.0.0.1
#local_port = 22
#remote_port = 32964

[http]
type = http
local_ip = 127.0.0.1
local_port = 80
subdomain = anarckk

再配置systemctl服务

1
2
3
4
5
6
7
8
9
10
11
12
13
14
vim /usr/lib/systemd/system/frpc.service

[Unit]
Description=frpc
After=network.target remote-fs.target nss-lookup.target

[Service]
TimeoutStartSec=30
ExecStart=/usr/local/bin/frp/frpc -c /etc/frp/frpc.ini
ExecStop=/bin/kill $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

systemctl start frpc; // 启动 frpc

systemctl stop frpc; // 关闭 frpc

systemctl status frpc; // 查看当前 frpc 状态

systemctl enable frpc; // 开机启动

systemctl disable frpc; // 取消开机启动

参考链接

利用 frp 进行内网穿透

nginx

可以参考这个博客,LINUX安装NGINX

先装必要的库,gzip需要zlib库,rewrite模块需要pcre库,ssl功能需要openssl库,选usr/local为安装目录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
yum install -y gcc gcc-c++
cd /usr/local
安装pcre
wgetr http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz
tar -zxvf pcre-8.33.tar.gz // 解压
cd pcre-8.33
./configure
make && make install

安装ssl库
cd /usr/local
wget http://www.openssl.org/source/openssl-1.0.1j.tar.gz
tar -zxvf openssl-1.0.1j.tar.gz
cd openssl-1.0.1j
./config
make && make install

安装zlib库
cd /usr/local
wget http://zlib.net/zlib-1.2.11.tar.gz
tar -zxvf zlib-1.2.11.tar.gz
cd zlib=1.2.11
./configure
make && make install

安装nginx
cd nginx-1.6.11
$ ./configure --user=nobody --group=nobody --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_sub_module --with-http_ssl_module --with-stream
make && make install

若出现以下错误:

./configure: error:SSL modules reguire the openssl library

则执行

yum -y install openssl openssl-devel

注意一个报错

unknown directive “stream” in /usr/local/nginx/nginx.conf:16

我是安装了 nginx 只有,在文件中配置 stram 配置出错的,我的配置是

1
2
3
4
5
6
7
stream {
server {
listen 80;
proxy_connect_timeout 1s;
proxy_pass 192.168.216.1:25565;
}
}

初步想法是,在安装的时候没有指定 –-with-stream,重装一下试试。

在修复这个错误的时候,参考这篇博客编译nginx平滑添加stream模块

它在第2.3点提醒只要进行 make 操作就可以了,不要进行 make install ,会将原有nginx目录进行覆盖。但是,我不管它了,我直接执行了 make&&make install

问题解决。

nginx 的 systemctl 配置文件

vim /usr/lib/systemd/system/nginx.service

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[Uint]
Description=nginx
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
PrivateTmp=true

[Install]
WantedBy=multi-user.target

nginx 多配置一个重启的指令

systemctl restart nginx

评论